package dao.jpa;

import java.util.List;

import vo.Warn;
import dao.WarnDAO;

public class WarnDAOJpaImpl extends GenericDaoJpaImpl<Warn, Long> implements WarnDAO {

	public WarnDAOJpaImpl() {
		super(Warn.class);
	}

	public long findTotalCount() {
		return super.executeFinderCount("Warn.findTotalCount");
	}

	public List<Warn> findAll() {
		return super.executeFinder("Warn.findAll");
	}

	public List<Warn> findAll(int start, int pageSize) {
		return super.executeFinderPage("Warn.findAll", start, pageSize);
	}

	public List<Warn> getWarnsByUserId(long userId) {
		return super.executeFinder("Warn.findByUserId", userId);
	}

	public List<Warn> getWarnsByTopicId(long topicId) {
		return super.executeFinder("Warn.findByTopicId", topicId);
	}

	public Warn getById(long warnId) {
		return super.read(warnId);
	}

	public void update(long warnId) {
		Warn warn = super.read(warnId);
		super.update(warn);
	}

	public void delete(long warnId)// 不是真是删除
	{
		Warn warn = super.read(warnId);
		super.delete(warn);
	}

}
